/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

var os = '';
var screenSize = '';
var navigatorName = '';
var navigatorVersion = '';

if (navigator.userAgent.indexOf('Linux') != -1)
{
    os = "Linux";
}
else if(navigator.userAgent.indexOf('Mac') != -1)
{
    os = "Macintosh";
}
else if(navigator.userAgent.toLowerCase().indexOf('unix') != -1)
{
    os = "Unix";
}
else if ((navigator.userAgent.indexOf('Win')!= -1)&&(navigator.userAgent.indexOf('NT 2.0')!= -1))
{
    os = "Windows 95";
}
else if ((navigator.userAgent.indexOf('Win')!= -1)&&(navigator.userAgent.indexOf('NT 3.0')!= -1))
{
    os = "Windows 98";
}
else if ((navigator.userAgent.indexOf('Win')!=-1)&&(navigator.userAgent.indexOf('NT 4.0')!=-1))
{
    os = "Windows 2000";
}
else if ((navigator.userAgent.indexOf('Win')!=-1)&&(navigator.userAgent.indexOf('NT 5.0')!=-1) ||
         (navigator.userAgent.indexOf('Win')!=-1)&&(navigator.userAgent.indexOf('NT 5.1')!=-1))
{
    os = "Windows XP";
}
else if ((navigator.userAgent.indexOf('Win')!= -1)&&(navigator.userAgent.indexOf('NT 6.0')!= -1))
{
    os = "Windows Vista";
}
else {
    os = "Not found";
}

if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
    navigatorName = 'Firefox';
    navigatorVersion = new Number(RegExp.$1);
}
else if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) {
    navigatorName = 'Internet Explorer';
    navigatorVersion = new Number(RegExp.$1);
    if (navigatorVersion < 7) {
        if (os == "Windows XP"){
            //outdated
        }
    }
}
else if (/Opera[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
    navigatorName = 'Opera';
    navigatorVersion = new Number(RegExp.$1);
}
else if (/Chrome[\/\s](\d+\.\d+)/.test(navigator.userAgent)) {
    navigatorName = 'Chrome';
    navigatorVersion = new Number(RegExp.$1);
}
else {
    navigatorName = 'Not found';
    navigatorVersion = 'Not found';
}
screenSize = screen.width + "x" + screen.height;

function getOSName() {
    return os;
}

function getBrowserVersion() {
    return navigatorVersion;
}

function getBrowserName() {
    return navigatorName;
}

function getScreenSize() {
    return screenSize;
}